import request from '@/utils/request'

// 查询列表
export function list(query) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params: query
  })
}

export function all(data) {
  return request({
    url: '/system/role/all',
    method: 'post',
    data: data
  })
}
// 查询详细
export function getById(id) {
  return request({
    url: '/system/role/' + id,
    method: 'get'
  })
}

// 新增
export function save(data) {
  return request({
    url: '/system/role/add',
    method: 'post',
    data: data
  })
}

// 修改
export function update(data) {
  return request({
    url: '/system/role/edit',
    method: 'post',
    data: data
  })
}

// 删除
// export function remove(id) {
//   return request({
//     url: '/system/role/' + id,
//     method: 'delete'
//   })
// }

export function remove(data) {
  return request({
    url: '/system/role/delete',
    method: 'post',
    data: { deleteIds: data }
  })
}

// 查询菜单下拉树结构
export function treeselect(roleId) {
  return request({
    url: '/system/menu/treeselect/' + roleId,
    method: 'get'
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
  return request({
    url: '/system/menu/roleMenuTreeselect/' + roleId,
    method: 'get'
  })
}
